package com.zyl.pagergallery_java.volley;

import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

public class VolleyUtils {
    private VolleyUtils(Context context) {
        this.context = context;
    }

    private static VolleyUtils INSTANCE;
    private RequestQueue requestQueue;
    private Context context;

    //单例模式
    public static VolleyUtils getInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = new VolleyUtils(context);
        }
        return INSTANCE;
    }

    //懒加载
    public RequestQueue getRequestQueue() {
        if (requestQueue == null) {
            requestQueue = Volley.newRequestQueue(context);
        }
        return requestQueue;
    }


}
